<?php
include("$config[webroot]/module/company/includes/company_class.php");

class company_api extends user
{
	function company_api()
	{
		parent::user();
	}
	
	function update_uid($array)
	{	
		;
	}
	
	function delete_by_uid($array)
	{
		$userid=$array['uid'];
		
		$this->db->query("select catid from ".USER." where userid='$userid'");
		$re=$this->db->fetchRow();
		$catid=explode(",",$re['catid']);
		foreach($catid as $vc)
		{
			update_cat_nums($vc,'del','com');
		}
		
		$this->db->query("select logo from ".USER." where userid='$userid'");
		$logo=$this->db->fetchField('logo');
		@unlink("../uploadfile/userimg/$logo.jpg");
		@unlink("../uploadfile/userimg/size_small/$logo.jpg");
		
		$this->db->query("delete from ".USER." where userid='$userid'");
		$this->db->query("delete from ".UDETAIL." where userid='$userid'");
		$this->db->query("delete from ".CUSTOM_CAT." where userid='$userid'");
		$this->db->query("delete from ".UDOMIN." where userid='$userid'");
		$this->db->query("delete from ".BUSINESS." where userid='$userid'");

	}
}
?>